Fix mypy errors with SQLAlchemy 2.0.46+#681
Merged
laughingman7743 merged 3 commits intomasterfrom Feb 21, 2026
Merged
Conversation
Update type annotations in compiler.py and aio/sqlalchemy/base.py to match stricter type signatures introduced in SQLAlchemy 2.0.46: - Update visit_* method signatures in AthenaTypeCompiler to use concrete SQLAlchemy types instead of generic Type[Any] - Update _render_string_type calls to match new API signature (name, length, collation) instead of (type_obj, name) - Change function_argspec parameter from FunctionElement to Function - Fix DDL constraint visitor return types (str instead of Optional[str]) - Change _DialectArgDict type alias to Mapping[str, Any] to match SQLAlchemy's MutableMapping-based _DialectArgDict - Add type: ignore comments for async adapter protocol mismatches - Upgrade SQLAlchemy from 2.0.36 to 2.0.46 in uv.lock Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SQLAlchemy 2.0.46 calls cursor._async_soft_close() in the async result handling path (_ensure_sync_result). Add a no-op implementation matching the pattern used by SQLAlchemy's own asyncpg adapter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SQLAlchemy 2.0.46 removed BizarroCharacterFKResolutionTest from the testing suite, causing a NameError during test collection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #680
pyathena/sqlalchemy/compiler.pyto match stricter type signatures introduced in SQLAlchemy 2.0.46 (visit_*methods,_render_string_typeAPI change,FunctionvsFunctionElement, DDL constraint return types,_DialectArgDicttype)type: ignorecomments inpyathena/aio/sqlalchemy/base.pyfor async adapter protocol mismatches (standard pattern in SQLAlchemy async adapters)uv.lockTest plan
make fmt— passesmake chk— 0 mypy errors (was 40)make test-sqla— SQLAlchemy dialect tests (requires AWS credentials)🤖 Generated with Claude Code